﻿#if UNITY_EDITOR
using System.IO;
using UnityEngine;
/// <summary>
/// 语言包设定窗口
/// </summary>
class EditorWindow_LanguageSetting : AbsESF_EditorWindow
{
    /// <summary>
    /// 语言枚举路径
    /// </summary>
    string mEnumLangFilePath = string.Empty;

    protected override AbsESF_EditorBuildAsset config => ESF_Logic.languageSetting;

    private void OnFocus()
    {        
        mEnumLangFilePath = Path.Combine(Path.GetDirectoryName(ESF_Utility.GetSubToAssets(ESF_Utility.TraceCaller_SourceFilePath())), typeof(enESF_LanguageClassify).Name + enESF_UnityFileExt.CS.ESF_FirstAttribute<ESF_FileExtAttribute>().ext);
    }

    /// <summary>
    /// OnBeforeRunGUI
    /// </summary>
    protected override void OnBeforeRunGUI()
    {
        GUILayout.BeginHorizontal();
        GUILayout.Label($"语言枚举cs文件：{mEnumLangFilePath}");
        if (GUILayout.Button(ESF_enGUIDisplayWord.Brower.ESF_ToAlias()))
        {
            ESF_Utility.PingObject(mEnumLangFilePath);
        }
        GUILayout.EndHorizontal();
    }

    protected override void OnRunGUI()
    {
        if (GUILayout.Button(ESF_enGUIDisplayWord.Save.ESF_ToAlias()))
        {
            if (OnSaveConfig())
            {

            }
        }
        if (GUILayout.Button(ESF_enGUIDisplayWord.Build.ESF_ToAlias()))
        {
            if (OnSaveConfig())
            {
                ESF_Logic.BuildLanguageScript();
            }           
        }
    }
}
#endif
